package com.zhaokuner.parentstarter.config;

import com.zhaokuner.parentstarter.handler.HttpReqInfoUtil;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * <p>
 * Description:添加 请求相关数据
 * <p>
 * Copyright: 天津联想协同科技有限公司
 * <p>
 *
 * @author 赵希坤 zhaoxikun
 * @date 2021/12/19 6:49 下午
 */
@WebFilter
public class CtrlFilter implements Filter {

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        HttpReqInfoUtil.initialize((HttpServletRequest) request, (HttpServletResponse) response);
        chain.doFilter(request, response);
        HttpReqInfoUtil.remove();
    }

}
